package aapilast3;

import java.lang.reflect.Method;

public class ReflectDemo7 {
    public static void main(String[] args) throws Exception{
        Person p = new Person();
        p.say("你好");
        Class<?> cls = Class.forName("aapilast3.Person");
        Object obj = cls.newInstance();

        Method method = cls.getMethod("say", String.class);
        method.invoke(obj, "你好2");

        Method method1 = cls.getMethod("say", String.class,int.class);
        method1.invoke(obj, "你好3",3);
    }
}
